package com.xja.warehouse.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.xja.common.valid.AddGroup;
import com.xja.common.valid.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

/**
 * 
 * 
 * @author 共月
 * @email 1106739528@qq.com
 * @date 2023-11-25 22:10:12
 */
@Data
@TableName("bus_customer")
public class CustomerEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 
	 */
	@TableId
//	@Null(message = "新增时id必须为空",groups = AddGroup.class)
//	@NotNull(message = "修改时id不能为空",groups = UpdateGroup.class)
	private Integer id;
	/**
	 * 
	 */
	@NotEmpty(message = "客户名称不能为空")
	@Length(min = 2,max = 10,message = "客户名称长度必须在2-10之间")
	private String customername;
	/**
	 * 
	 */
	@NotEmpty(message = "邮编不能为空")
	private String zip;
	/**
	 * 
	 */
	@NotEmpty(message = "客户地址不能为空")
	private String address;
	/**
	 * 
	 */
	@NotEmpty(message = "客户电话不能为空")
	@Pattern(regexp = "^[1][3-9][0-9]{9}$",message = "客户电话必须为11位数字")
	private String telephone;
	/**
	 * 
	 */
	@NotEmpty(message = "联系人不能为空")
	private String connectionpersion;
	/**
	 * 
	 */
	@NotEmpty(message = "联系人电话不能为空")
	@Pattern(regexp = "^[1][3-9][0-9]{9}$",message = "联系人电话必须为11位数字")
	private String phone;
	/**
	 * 
	 */
	@NotEmpty(message = "开户银行不能为空")
	private String bank;
	/**
	 * 
	 */
	@NotEmpty(message = "银行账户不能为空")
	private String account;
	/**
	 * 
	 */
	@NotEmpty(message = "邮箱不能为空")
	@Email(message = "邮箱格式不正确")
	private String email;
	/**
	 * 
	 */
	@NotEmpty(message = "传真不能为空")
	private String fax;
	/**
	 * 
	 */
	@NotNull(message = "状态不能为空")
	@Max(value = 1,message = "状态只能为0或1")
	@Min(value = 0,message = "状态只能为0或1")
	private Integer available;

	@TableLogic
	private Integer delete_status;


	public CustomerEntity() {
		// 设置逻辑删除字段的默认值为1
		this.delete_status = 1;
	}
}
